//管理员service层实现类
package com.sy.service.impl;

import java.util.List;

import com.sy.dao.impl.AdminDaoImpl;
import com.sy.dao.impl.PageDaoImpl;
import com.sy.service.AdminService;
import com.sy.util.Page;
import com.sy.vo.Admin;

@SuppressWarnings("unchecked")
public class AdminServiceImpl extends BaseServiceImpl implements AdminService {

	private PageDaoImpl Pdao;
	private AdminDaoImpl dao;
	
	//添加管理员
	public void addAdmin(Admin admin) {
		dao.addAdmin(admin);
	}
//删除管理员
	public void deleteAdmin(Integer id) {
		dao.deleteAdmin(id);
	}
//获得管理员信息
	public Admin getAdmin(Integer id) {
		return dao.getAdmin(id);
	}
//验证登陆是否成功

	public boolean islogin(String username,String password) {
		return dao.islogin(username, password);
	}
//获取管理员列表
	@SuppressWarnings("unchecked")
	public List<Admin> listAdmins() {
		return dao.listAdmins();
	}
//修改管理员信息
	public void updateAdmin(Admin admin) {
		dao.updateAdmin(admin);
	}
//获得spring的bean配置
	public void setDao(AdminDaoImpl dao) {
		this.dao=dao;
	}
//获得spring的bean配置
	public void setPdao(PageDaoImpl Pdao) {
		this.Pdao = Pdao;
	}
	public Page getPage() {
		return Pdao.getPage();
	}
	public void init(int pno) {
		String tableName="Admin";
		Pdao.init(pno,tableName);
	}
}